import SimpleHTTPServer
import SocketServer
import os

config = {}
config["root"] = "D:/"
config["host"] = "127.0.0.1"
config["port"] = 8080

class Handler(SimpleHTTPServer.SimpleHTTPRequestHandler):  
   def translate_path(self, path):  
        os.chdir(config["root"])  
        return SimpleHTTPServer.SimpleHTTPRequestHandler.translate_path(self,path)  
   
try:  
    httpd = SocketServer.TCPServer(("", config["port"]), Handler)  
    print "dir %s serving at port %s"%(repr(config["root"]), config["port"])  
    httpd.serve_forever()  
except:pass 